﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using lgweb.common;
using LGCourt.Logic.BLL;
using KMFrame.Core;
using LGCourt.Logic.NBL.DBEntities;
using LGCourt.Logic.Common;
using System.Text;
using System.Web.Security;
using KMFrame.Permission.Util;

namespace lgweb.inside
{
    public partial class index : NeedValidatePage
    {
        public string _picUrl = string.Empty;
        delegate PageResult DlgTongzhiGonggao(OANoticeCondition param);
        delegate PageResult DlgDaibanShixiang(OAFlowCondition param);
        delegate PageResult DlgGongWenChuanyue(OAFlowCondition param);
        delegate List<vOAShiwuShenqing> DlgShiwuShenqing(OACondition param);
        delegate PageResult DlgKaitingPaiqi(OACondition param);
        delegate List<vOATongjiBaobiao> DlgTongjiBaobiao(OACondition param);
        delegate PageResult DlgGongZuoLiuYan(OAMessageCondition param);
        delegate PageResult DlgPaiTouBing(OANoticeCondition param);
        delegate PageResult DlgXinXiBaoSong(OANoticeCondition param);
        delegate List<LGFY_Platform_Articles> DlgNewsInfo(QueryCondition param);
        delegate List<LGFY_Platform_NewsOfPic> DlgPicInfo(QueryCondition param);
        delegate IEnumerable<vBlogHomeInfo> DlgBlog(InfoCondition param);
        delegate IEnumerable<vForumTradeInfo> DlgForum(InfoCondition param);
        delegate PageResult DlgTongxunlu(OACondition param);
        protected new void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);
            if (!this.IsPostBack)
            {
                GetSSODomain();
                GetList();               
            }
        }

        private void GetList()
        {
            #region 发起异步
            #region OA信息
            OA bll = new OA();

            //通知公告
            OANoticeCondition noticParam = new OANoticeCondition();
            noticParam.UserID = this.SessionInfo.UserID;
            noticParam.PageIndex = 1;
            noticParam.PageSize = 7;
            //PageResult result = (PageResult)bll.GetTongzhiGonggaoPage(noticParam);
            DlgTongzhiGonggao dlgtzgg = new DlgTongzhiGonggao(bll.GetTongzhiGonggaoPage);
            IAsyncResult artzgg = dlgtzgg.BeginInvoke(noticParam, null, null);

            //待办流程
            OAFlowCondition flowParam = new OAFlowCondition();
            flowParam.UserID = this.SessionInfo.UserID;
            flowParam.PageIndex = 1;
            flowParam.PageSize = 6;
            //result = (PageResult)bll.GetDaibanShixiangPage(flowParam);
            DlgDaibanShixiang dlgdbsx = new DlgDaibanShixiang(bll.GetDaibanShixiangPage);
            IAsyncResult ardbsx = dlgdbsx.BeginInvoke(flowParam, null, null);

            //公文传阅           
            //result = (PageResult)bll.GetGongWenChuanyuePage(flowParam);
            DlgGongWenChuanyue dlggwcy = new DlgGongWenChuanyue(bll.GetGongWenChuanyuePage);
            IAsyncResult argwcy = dlggwcy.BeginInvoke(flowParam, null, null);

            //事务申请
            OACondition swsqParam = new OACondition();
            swsqParam.UserID = this.SessionInfo.UserID;
            swsqParam.PageIndex = 1;
            swsqParam.PageSize = 6;
            // List<vOAShiwuShenqing> list = (List<vOAShiwuShenqing>)bll.GetShiwuShenqingPage(param);
            DlgShiwuShenqing dlgswsq = new DlgShiwuShenqing(bll.GetShiwuShenqingPage);
            IAsyncResult arswsq = dlgswsq.BeginInvoke(swsqParam, null, null);

            //统计报表
            OACondition tjbbParam = new OACondition();
            tjbbParam.UserID = this.SessionInfo.UserID;
            tjbbParam.PageIndex = 1;
            tjbbParam.PageSize = 6;
            DlgTongjiBaobiao dlgtjbb = new DlgTongjiBaobiao(bll.GetTongjiBaobiaoTop);
            IAsyncResult artjbb = dlgtjbb.BeginInvoke(tjbbParam, null, null);

            //工作留言
            OAMessageCondition messParam = new OAMessageCondition();
            messParam.UserID = this.SessionInfo.UserID;
            messParam.IsRead = 0;
            messParam.PageIndex = 1;
            messParam.PageSize = 6;
            DlgGongZuoLiuYan dlgmessage = new DlgGongZuoLiuYan(bll.GetGongZuoLiuYanPage);
            IAsyncResult armessage = dlgmessage.BeginInvoke(messParam, null, null);

            //排头兵    
            OANoticeCondition ptbParam = new OANoticeCondition();
            ptbParam.UserID = this.SessionInfo.UserID;           
            ptbParam.PageIndex = 1;
            ptbParam.PageSize = 5;
           // ptbParam.IsRead = 0;
            DlgPaiTouBing dlgptb = new DlgPaiTouBing(bll.GetPaiTouBingPage);
            IAsyncResult arptb = dlgptb.BeginInvoke(ptbParam, null, null);
            //简报
            OANoticeCondition jbParam = new OANoticeCondition();
            jbParam.UserID = this.SessionInfo.UserID;
            jbParam.nClass = "简报";
            jbParam.PageIndex = 1;
            jbParam.PageSize = 5;
            IAsyncResult arjb = dlgtzgg.BeginInvoke(jbParam, null, null);

            //信息报送
            OANoticeCondition xxbsParam = new OANoticeCondition();
            xxbsParam.UserID = this.SessionInfo.UserID;
            xxbsParam.PageIndex = 1;
            xxbsParam.PageSize = 5;
            DlgXinXiBaoSong dlgxxbs = new DlgXinXiBaoSong(bll.GetXinXiBaoSongPage);
            IAsyncResult arxxbs = dlgxxbs.BeginInvoke(xxbsParam, null, null);

            //党务工作
            OANoticeCondition dwgzParam = new OANoticeCondition();
            dwgzParam.UserID = this.SessionInfo.UserID;
            dwgzParam.nClass = "党务工作";
            dwgzParam.PageIndex = 1;
            dwgzParam.PageSize = 5;
            IAsyncResult ardwgz = dlgtzgg.BeginInvoke(dwgzParam, null, null);

            //通讯录
            vOAUser oaUser = (vOAUser)bll.GetUserInfo(SessionBox.GetUserSession().UserID);
            OACondition txlParam = new OACondition();
            txlParam.UserID = this.SessionInfo.UserID;
            txlParam.PageIndex = 1;
            txlParam.PageSize = 5;
            txlParam.DeptName = oaUser == null ? "" : oaUser.deptname;
            DlgTongxunlu dlgtxl = new DlgTongxunlu(bll.GetTongxunluPage);
            IAsyncResult artxl = dlgtxl.BeginInvoke(txlParam, null, null);
            #endregion
            #region 新闻资讯
            //新闻
            ColInfo colInfoBLL = new ColInfo();
            QueryCondition queryParam = new QueryCondition();
            //BBS bbsBLL = new BBS();
            //InfoCondition infoParam = new InfoCondition();
            //infoParam.PageSize = 3;
            //infoParam.InfoTag = "图片新闻";
            //IEnumerable<vPortalArticleTitleEx> newsList = bbsBLL.GetNewsInfoTop(infoParam);
            //轮播图片
            DlgPicInfo dlgPicInfo = new DlgPicInfo(colInfoBLL.GetPicInfoTop);
            queryParam.PageSize = 5;
            queryParam.IsPicRoll = true;
            IAsyncResult arRoll = dlgPicInfo.BeginInvoke(queryParam, null, null);

            //图片新闻
            queryParam.PageSize = 3;
            queryParam.IsPicRoll = false;
            //List<LGFY_Platform_NewsOfPic> newsList = colInfoBLL.GetPicInfoTop(queryParam);             
            IAsyncResult arPicInfo = dlgPicInfo.BeginInvoke(queryParam, null, null);

            DeptClassCondition classParam = new DeptClassCondition();
            classParam.Name = "首页栏目";
            List<V_DICT_SOURCE> classInfoList = colInfoBLL.GetDeptSourceList(classParam);
            DlgNewsInfo dlgNewsInfo = new DlgNewsInfo(colInfoBLL.GetNewsInfoTop);
            //时事要闻
            //infoParam.PageSize = 7;
            //infoParam.InfoTag = "时事要闻";
            //IEnumerable<vPortalArticleTitleEx> newsList1 = bbsBLL.GetNewsInfoTop(infoParam);
            QueryCondition queryParam1 = new QueryCondition();
            queryParam1.PageSize = 7;
            queryParam1.ClassID = classInfoList.Count >= 1 ? classInfoList[0].ID.GetValueOrDefault(0) : 1;
            IAsyncResult arNewsInfo1 = dlgNewsInfo.BeginInvoke(queryParam1, null, null);
            //法治聚焦
            //infoParam.InfoTag = "法治聚焦";
            //IEnumerable<vPortalArticleTitleEx> newsList2 = bbsBLL.GetNewsInfoTop(infoParam);
            QueryCondition queryParam2 = new QueryCondition();
            queryParam2.PageSize = 7;
            queryParam2.ClassID = classInfoList.Count >= 2 ? classInfoList[1].ID.GetValueOrDefault(0) : 2;
            IAsyncResult arNewsInfo2 = dlgNewsInfo.BeginInvoke(queryParam2, null, null);
            //文苑沙龙
            //infoParam.InfoTag = "文苑沙龙";
            //IEnumerable<vPortalArticleTitleEx> slList = bbsBLL.GetNewsInfoTop(infoParam);
            QueryCondition queryParam3 = new QueryCondition();
            queryParam3.PageSize = 5;
            queryParam3.ClassID = classInfoList.Count >= 3 ? classInfoList[2].ID.GetValueOrDefault(0) : 3;
            IAsyncResult arNewsInfo3 = dlgNewsInfo.BeginInvoke(queryParam3, null, null);
            //专题研究
            //infoParam.InfoTag = "专题研究";
            //IEnumerable<vPortalArticleTitleEx> ztList = bbsBLL.GetNewsInfoTop(infoParam);
            QueryCondition queryParam7 = new QueryCondition();
            queryParam7.PageSize = 5;
            queryParam7.ClassID = classInfoList.Count >= 7 ? classInfoList[6].ID.GetValueOrDefault(0) : 7;
            IAsyncResult arNewsInfo7 = dlgNewsInfo.BeginInvoke(queryParam7, null, null);
            //他山之石
            //infoParam.InfoTag = "他山之石";
            //IEnumerable<vPortalArticleTitleEx> slList2 = bbsBLL.GetNewsInfoTop(infoParam);
            QueryCondition queryParam4 = new QueryCondition();
            queryParam4.PageSize = 5;
            queryParam4.ClassID = classInfoList.Count >= 4 ? classInfoList[3].ID.GetValueOrDefault(0) : 4;
            IAsyncResult arNewsInfo4 = dlgNewsInfo.BeginInvoke(queryParam4, null, null);
            //书画摄影
            //infoParam.InfoTag = "书画摄影";
            //IEnumerable<vPortalArticleTitleEx> slList3 = bbsBLL.GetNewsInfoTop(infoParam);
            QueryCondition queryParam5 = new QueryCondition();
            queryParam5.PageSize = 5;
            queryParam5.ClassID = classInfoList.Count >= 5 ? classInfoList[4].ID.GetValueOrDefault(0) : 5;
            IAsyncResult arNewsInfo5 = dlgNewsInfo.BeginInvoke(queryParam5, null, null);
            //文体生活
            //infoParam.InfoTag = "文体生活";
            //IEnumerable<vPortalArticleTitleEx> slList4 = bbsBLL.GetNewsInfoTop(infoParam);
            QueryCondition queryParam6 = new QueryCondition();
            queryParam6.PageSize = 5;
            queryParam6.ClassID = classInfoList.Count >= 6 ? classInfoList[5].ID.GetValueOrDefault(0) : 6;
            IAsyncResult arNewsInfo6 = dlgNewsInfo.BeginInvoke(queryParam6, null, null);
            //争鸣园地
            //infoParam.InfoTag = "争鸣园地";
            //IEnumerable<vPortalArticleTitleEx> ztList2 = bbsBLL.GetNewsInfoTop(infoParam);
            QueryCondition queryParam8 = new QueryCondition();
            queryParam8.PageSize = 5;
            queryParam8.ClassID = classInfoList.Count >= 8 ? classInfoList[7].ID.GetValueOrDefault(0) : 8;
            IAsyncResult arNewsInfo8 = dlgNewsInfo.BeginInvoke(queryParam8, null, null);
            //案例评析
            //infoParam.InfoTag = "案例评析";
            //IEnumerable<vPortalArticleTitleEx> ztList3 = bbsBLL.GetNewsInfoTop(infoParam);
            QueryCondition queryParam9 = new QueryCondition();
            queryParam9.PageSize = 5;
            queryParam9.ClassID = classInfoList.Count >= 9 ? classInfoList[8].ID.GetValueOrDefault(0) : 9;
            IAsyncResult arNewsInfo9 = dlgNewsInfo.BeginInvoke(queryParam9, null, null);
            //优秀文书
            //infoParam.InfoTag = "优秀文书";            
            //IEnumerable<vPortalArticleTitleEx> ztList4 = bbsBLL.GetNewsInfoTop(infoParam);
            QueryCondition queryParam10 = new QueryCondition();
            queryParam10.PageSize = 5;
            queryParam10.ClassID = classInfoList.Count >= 10 ? classInfoList[9].ID.GetValueOrDefault(0) : 10;
            IAsyncResult arNewsInfo10 = dlgNewsInfo.BeginInvoke(queryParam10, null, null);
            //下载中心
            QueryCondition queryParam11 = new QueryCondition();
            queryParam11.PageSize = 5;
            queryParam11.ClassID = classInfoList.Count >= 11 ? classInfoList[10].ID.GetValueOrDefault(0) : 11;
            IAsyncResult arNewsInfo11 = dlgNewsInfo.BeginInvoke(queryParam11, null, null);
            #endregion
            #region 博客论坛开庭排期等
            //博客
            BBS bbsBLL = new BBS();
            InfoCondition infoParam = new InfoCondition();
            infoParam.PageSize = 5;
            infoParam.InfoTag = "博客";
            DlgBlog dlgBlog = new DlgBlog(bbsBLL.GetBlogTop);
            IAsyncResult arBlog = dlgBlog.BeginInvoke(infoParam, null, null);

            //论坛
            infoParam.InfoTag = "论坛";
            //IEnumerable<vForumTradeInfo> ltList = bbsBLL.GetForumTop(infoParam);
            DlgForum dlgForum = new DlgForum(bbsBLL.GetForumTop);
            IAsyncResult arForum = dlgForum.BeginInvoke(infoParam, null, null);

            //开庭排期
            OACondition ktpqParam = new OACondition();
            ktpqParam.UserID = this.SessionInfo.UserID;
            ktpqParam.PageIndex = 1;
            ktpqParam.PageSize = 6;
            DlgKaitingPaiqi dlgktpq = new DlgKaitingPaiqi(bll.GetKaitingPaiqiPage);
            IAsyncResult arktpq = dlgktpq.BeginInvoke(ktpqParam, null, null);
            #endregion
            #endregion
            #region 获取结果

            #region OA信息-获取结果
            //通知公告
            PageResult result = dlgtzgg.EndInvoke(artzgg);
            if (result != null && result.ResultList != null)
            {
                this.rptNoticeList.DataSource = (List<vOATongzhiGonggao>)result.ResultList;
                this.rptNoticeList.DataBind();
            }

            //代办事项
            result = dlgdbsx.EndInvoke(ardbsx);
            if (result != null && result.ResultList != null)
            {
                List<vOADaibanShixiang> oaflowList = (List<vOADaibanShixiang>)result.ResultList;

                this.rptWaitFlowList.DataSource = oaflowList;// oaflowList.Where(a => !string.IsNullOrEmpty(a.myname)).ToList();
                this.rptWaitFlowList.DataBind();
                spWaitFlowCount.InnerText = result.TotalCount.ToString();
            }

            //公文传阅
            result = dlggwcy.EndInvoke(argwcy);
            if (result != null && result.ResultList != null)
            {
                List<vOALiuChengChuanYue> oasenderList = (List<vOALiuChengChuanYue>)result.ResultList;
                this.rptGongWenChuanYueList.DataSource = oasenderList;
                this.rptGongWenChuanYueList.DataBind();
            }

            //事务申请
            List<vOAShiwuShenqing> list = dlgswsq.EndInvoke(arswsq);
            if (list != null)
            {
                this.rptNewFlowList.DataSource = list;
                this.rptNewFlowList.DataBind();
            }

            //统计报表
            //List<vOATongjiBaobiao> reportlist = (List<vOATongjiBaobiao>)bll.GetTongjiBaobiaoTop(param);
            List<vOATongjiBaobiao> reportlist = dlgtjbb.EndInvoke(artjbb);
            if (reportlist != null)
            {
                this.rptReportList.DataSource = reportlist;
                this.rptReportList.DataBind();
            }
            //留言
            //result = (PageResult)bll.GetGongZuoLiuYanPage(messParam);
            result = dlgmessage.EndInvoke(armessage);
            if (result != null && result.ResultList != null)
            {
                this.rptMessageList.DataSource = (List<vOAGongZuoLiuYan>)result.ResultList;
                this.rptMessageList.DataBind();
            }
            //排头兵
            //result = (PageResult)bll.GetPaiTouBingPage(noticeParam);
            result = dlgptb.EndInvoke(arptb);
            if (result != null && result.ResultList != null)
            {
                this.rptjbList4.DataSource = (List<vOAPaiTouBingZhuanLan>)result.ResultList;
                this.rptjbList4.DataBind();
            }
            //简报
            //result = (PageResult)bll.GetTongzhiGonggaoPage(noticeParam);
            result = dlgtzgg.EndInvoke(arjb);
            if (result != null && result.ResultList != null)
            {
                this.rptjbList.DataSource = (List<vOATongzhiGonggao>)result.ResultList;
                this.rptjbList.DataBind();
            }
            //信息报送
            //result = (PageResult)bll.GetXinXiBaoSongPage(noticeParam);
            result = dlgxxbs.EndInvoke(arxxbs);
            if (result != null && result.ResultList != null)
            {
                this.rptjbList2.DataSource = (List<vOAXinXiBaoSong>)result.ResultList;
                this.rptjbList2.DataBind();
            }
            //党务工作
            //result = (PageResult)bll.GetTongzhiGonggaoPage(noticeParam);
            result = dlgtzgg.EndInvoke(ardwgz);
            if (result != null && result.ResultList != null)
            {
                this.rptjbList3.DataSource = (List<vOATongzhiGonggao>)result.ResultList;
                this.rptjbList3.DataBind();
            }

            //通讯录
            //PageResult txlList = bll.GetTongxunluPage(param);
            PageResult txlList = dlgtxl.EndInvoke(artxl);
            if (txlList != null && txlList.ResultList != null)
            {
                this.rptTongXunLuList.DataSource = (List<vOATongXunLu>)txlList.ResultList;
                this.rptTongXunLuList.DataBind();
            }
            #endregion
            #region 新闻资讯--获取结果
            //轮播图片
            //List<LGFY_Platform_NewsOfPic> rollList = colInfoBLL.GetPicInfoTop(queryParam);
            List<LGFY_Platform_NewsOfPic> rollList = dlgPicInfo.EndInvoke(arRoll);
            if (rollList != null)
            {
                this.rptPicRollList.DataSource = rollList;
                this.rptPicRollList.DataBind();
                this.rptPicRolTitleList.DataSource = rollList;
                this.rptPicRolTitleList.DataBind();
            }
            //图片新闻
            //List<LGFY_Platform_NewsOfPic> newsList = colInfoBLL.GetPicInfoTop(queryParam);
            List<LGFY_Platform_NewsOfPic> newsList = dlgPicInfo.EndInvoke(arPicInfo);
            if (newsList != null)
            {
                this.rptPicnews.DataSource = newsList;
                this.rptPicnews.DataBind();
            }

            //List<LGFY_Platform_Articles> newsList1 = colInfoBLL.GetNewsInfoTop(queryParam);
            List<LGFY_Platform_Articles> newsList1 = dlgNewsInfo.EndInvoke(arNewsInfo1);
            if (newsList1 != null)
            {
                this.rptNoticeList3.DataSource = newsList1;
                this.rptNoticeList3.DataBind();
            }

            //List<LGFY_Platform_Articles> newsList2 = colInfoBLL.GetNewsInfoTop(queryParam);
            List<LGFY_Platform_Articles> newsList2 = dlgNewsInfo.EndInvoke(arNewsInfo2);
            if (newsList2 != null)
            {
                this.rptNoticeList4.DataSource = newsList2;
                this.rptNoticeList4.DataBind();
            }

            //List<LGFY_Platform_Articles> slList = colInfoBLL.GetNewsInfoTop(queryParam);
            List<LGFY_Platform_Articles> slList = dlgNewsInfo.EndInvoke(arNewsInfo3);
            if (slList != null)
            {
                this.rtpSLList.DataSource = slList;
                this.rtpSLList.DataBind();
            }

            //List<LGFY_Platform_Articles> ztList = colInfoBLL.GetNewsInfoTop(queryParam);
            List<LGFY_Platform_Articles> ztList = dlgNewsInfo.EndInvoke(arNewsInfo7);
            if (ztList != null)
            {
                this.rptZTList.DataSource = ztList;
                this.rptZTList.DataBind();
            }

            //List<LGFY_Platform_Articles> slList2 = colInfoBLL.GetNewsInfoTop(queryParam);
            List<LGFY_Platform_Articles> slList2 = dlgNewsInfo.EndInvoke(arNewsInfo4);
            if (slList2 != null)
            {
                this.rtpSLList2.DataSource = slList2;
                this.rtpSLList2.DataBind();
            }

            //List<LGFY_Platform_Articles> slList3 = colInfoBLL.GetNewsInfoTop(queryParam);
            List<LGFY_Platform_Articles> slList3 = dlgNewsInfo.EndInvoke(arNewsInfo5);
            if (slList3 != null)
            {
                this.rtpSLList3.DataSource = slList3;
                this.rtpSLList3.DataBind();
            }

            //List<LGFY_Platform_Articles> slList4 = colInfoBLL.GetNewsInfoTop(queryParam);
            List<LGFY_Platform_Articles> slList4 = dlgNewsInfo.EndInvoke(arNewsInfo6);
            if (slList4 != null)
            {
                this.rtpSLList4.DataSource = slList4;
                this.rtpSLList4.DataBind();
            }
            //List<LGFY_Platform_Articles> ztList2 = colInfoBLL.GetNewsInfoTop(queryParam);
            List<LGFY_Platform_Articles> ztList2 = dlgNewsInfo.EndInvoke(arNewsInfo8);
            if (ztList2 != null)
            {
                this.rptZTList2.DataSource = ztList2;
                this.rptZTList2.DataBind();
            }
            //List<LGFY_Platform_Articles> ztList3 = colInfoBLL.GetNewsInfoTop(queryParam);
            List<LGFY_Platform_Articles> ztList3 = dlgNewsInfo.EndInvoke(arNewsInfo9);
            if (ztList3 != null)
            {
                this.rptZTList3.DataSource = ztList3;
                this.rptZTList3.DataBind();
            }

            //List<LGFY_Platform_Articles> ztList4 = colInfoBLL.GetNewsInfoTop(queryParam);
            List<LGFY_Platform_Articles> ztList4 = dlgNewsInfo.EndInvoke(arNewsInfo10);
            if (ztList4 != null)
            {
                this.rptZTList4.DataSource = ztList4;
                this.rptZTList4.DataBind();
            }

            //下载中心
            //List<LGFY_Platform_Articles> xzList = colInfoBLL.GetNewsInfoTop(queryParam);
            List<LGFY_Platform_Articles> xzList = dlgNewsInfo.EndInvoke(arNewsInfo11);
            if (xzList != null)
            {
                this.rptXZList.DataSource = xzList;
                this.rptXZList.DataBind();
            }
            #endregion
            #region 博客论坛开庭排期等--获取结果
            //开庭排期
            //result = bll.GetKaitingPaiqiPage(param);
            result = dlgktpq.EndInvoke(arktpq);
            if (result != null && result.ResultList != null)
            {
                this.rptSchedulingList.DataSource = (List<pKTPQ>)result.ResultList;
                this.rptSchedulingList.DataBind();
            }

            //博客
            //IEnumerable<vBlogHomeInfo> bkList = bbsBLL.GetBlogTop(infoParam);
            IEnumerable<vBlogHomeInfo> bkList = dlgBlog.EndInvoke(arBlog);
            if (bkList != null)
            {
                this.rptBKList.DataSource = bkList;
                this.rptBKList.DataBind();
            }

            //论坛
            //IEnumerable<vForumTradeInfo> ltList = bbsBLL.GetForumTop(infoParam);
            IEnumerable<vForumTradeInfo> ltList = dlgForum.EndInvoke(arForum);
            if (ltList != null)
            {
                this.rptBKList2.DataSource = ltList;
                this.rptBKList2.DataBind();
            }
            #endregion
            #endregion
        }
        private void GetSSODomain()
        {
            TimeSpan tp=(DateTime.Now-DateTime.Parse("1970-01-01"));
            UserInfo userBLL = new UserInfo();
            pUserLinkInfo userParam = new pUserLinkInfo();
            userParam.UserName = this.SessionInfo.UserName;            
            pUserLinkInfo userLinkInfo = userBLL.GetUserLinkInfo(userParam);
            string userName = this.SessionInfo.UserName;
            string sysUserID = this.SessionInfo.UserID.ToString();
            byte[] bytes=Encoding.Default.GetBytes(userName);
            string decodeUserName = Convert.ToBase64String(bytes);
            string uts = Utils.GetTimestamp();

            this.ZHYWDomain.HRef = GetConfigDomain("ZHYWDomain", decodeUserName, GetUserID(userLinkInfo, "ZHYWDomain", sysUserID), true);
            this.hdOADomain.Value = GetConfigDomain("OADomain",userName,sysUserID,false);// System.Configuration.ConfigurationManager.AppSettings["OADomain"];
            this.SZFTDomain.HRef = GetConfigDomain("SZFTDomain", null, "", false) + "?username=" + userName + "&timestamp=" + Convert.ToInt64(tp.TotalMilliseconds).ToString();
            this.CMPDomain.HRef = GetConfigDomain("CMPDomain", userName, GetUserID(userLinkInfo, "CMPDomain", sysUserID), true); 
            this.YNJKDomain.HRef = GetConfigDomain("YNJKDomain", userName, sysUserID, false);
            this.AJPCDomain.HRef = GetConfigDomain("AJPCDomain", userName, sysUserID, false);
            this.SJJHDomain.HRef = GetConfigDomain("SJJHDomain", null, "", false) + "?UID=" + sysUserID + "&UTS=" + uts + "&UKEY=" + MD5(sysUserID + uts + "a312b8cd2216132e6fg5718h39494601");
            this.KQGLDomain.HRef = GetConfigDomain("KQGLDomain", userName, GetUserID(userLinkInfo, "KQGLDomain", sysUserID), true);
            this.GJZFDADomain.HRef = GetConfigDomain("GJZFDADomain", userName, sysUserID, false);
            this.FYWWDomain.HRef = GetConfigDomain("FYWWDomain", userName, sysUserID, false);
            this.SGYDomain.HRef = GetConfigDomain("SGYDomain", userName, GetUserID(userLinkInfo, "SGYDomain", sysUserID), true);
            this.SZYDomain.HRef = GetConfigDomain("SZYDomain", userName, GetUserID(userLinkInfo, "SZYDomain", sysUserID), true);
            this.SJFYDomain.HRef = GetConfigDomain("SJFYDomain", userName, GetUserID(userLinkInfo, "SJFYDomain", sysUserID), true);
            this.FLFGDomain.HRef = GetConfigDomain("FLFGDomain", userName, GetUserID(userLinkInfo, "FLFGDomain", sysUserID), true);         
            
            _picUrl = GetConfigDomain("InfoManage", "", "", false);
            _picUrl = string.IsNullOrEmpty(_picUrl) ? "/lgmanage/Systems/upload/" : _picUrl;
        }

        private string GetUserID(pUserLinkInfo userLinkInfo,string domainName,string defaultName)
        {
            if (userLinkInfo == null)
                return defaultName;
            string result = defaultName;
            switch (domainName)
            {
                case "ZHYWDomain":                    
                    byte[] bytesID = Encoding.Default.GetBytes(userLinkInfo.ZHYWXT);
                    result = Convert.ToBase64String(bytesID);
                    break;
                case "SZTSGDomain":
                    result = userLinkInfo.SZTSG;
                    break;
                case "SGYDomain":
                    result = userLinkInfo.SGYNBW;
                    break;
                case "SZYDomain":
                    result = userLinkInfo.SZYGZW;
                    break;
                case "CMPDomain":
                    result = userLinkInfo.CMPCXXT;
                    break;
                case "SZFTDomain":
                    result = userLinkInfo.SZFTGLXT;
                    break;
                case "FLFGDomain":
                    result = userLinkInfo.FLFGCXXT;
                    break;
                case "SJFYDomain":
                    result = userLinkInfo.SJFYYJXT;
                    break;
            }
            if (string.IsNullOrEmpty(result))
            {
                result = defaultName;
            }

            return result;
        }     
       
        private string GetConfigDomain(string domainName,string username,string userid,bool isAddPrm)
        {
            string result = System.Configuration.ConfigurationManager.AppSettings[domainName];
            if (isAddPrm)
            {
                if (!string.IsNullOrEmpty(result) && result.IndexOf("?") > 0)
                {
                    result += "&m=" + Server.UrlEncode(username) + "&p=" + Server.UrlEncode(userid);
                }
                else
                {
                    result += "?m=" + Server.UrlEncode(username) + "&p=" + Server.UrlEncode(userid);
                }
            }
            return result;
        }
        public static string MD5(string s)
        {
            return FormsAuthentication.HashPasswordForStoringInConfigFile(s, "MD5").ToLower();
        }
    }
}
